<html>
	<head>
      <meta charset = "utf-8">
      <title>Class List</title>
   </head>
   <body>
   <?php
   	$query = "SELECT * from students";
	
   	// Connect to MySQL
	if ( !( $database = mysql_connect(
			"richmondj.coscy9cmelyy.us-east-1.rds.amazonaws.com","jason_richmond", "1fltbal2" ) ) )
		die( "<p>Could not connect to database</p></body></html>" );
			
	// open my database
	if ( !mysql_select_db( "richmondjdb", $database ) )
		die( "<p>Could not open my database</p>
             </body></html>" );
			 
	// query my database
	if ( !( $result = mysql_query( $query, $database ) ) )
	{
		print( "<p>Could not execute query!</p>" );
		die( mysql_error() . "</body></html>" );
	} // end if
	
	$text = "";
	print("<table><tr><td>UMID</td><td>First Name</td><td>Last Name</td><td>Phone Number</td><td>Email</td>
			<td>Project Title<td><td>Time Slot</td></tr>");
	while($row = mysql_fetch_row( $result ))
	{
		print("<tr><td>".$row[0]."</td>");
		print("<td>".$row[1]."</td>");
		print("<td>".$row[3]."</td>");
		print("<td>".$row[5]."</td>");
		print("<td>".$row[2]."</td>");
		print("<td>".$row[4]."</td>");
		
		//get timeslot
		$timeSlotId=$row[6];
		$query = "SELECT * from slots WHERE idslot='$timeSlotId'";
		
		// query my database
		if ( !( $slotResult = mysql_query( $query, $database ) ) )
		{
			print( "<p>Could not execute query!</p>" );
			die( mysql_error() . "</body></html>" );
		} // end if
		
		$slotInfo = mysql_fetch_row($slotResult);
		
		$slotDetails = $slotInfo[1]." ".$slotInfo[2];
		$slotText = "<td>".$slotDetails."</td></tr>";		
		print($slotText);		
	}
	
	print("</table>")
	
	?>
   </body>
</html>
